<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
	<title>物业管理系统</title>
    <base href="<%=basePath%>"> 
    <link rel="stylesheet" href="css/bootstrap.css">
    <link rel="stylesheet" href="css/vivo.css">
	
	<script src="js/jquery-1.11.1.js"></script>
    <script type="text/javascript" src="js/layer/layer/layer.js"></script> 
    <script type="text/javascript" src="js/sharefunction.js"></script>
    <link href="js/select2/select2.min.css" type="text/css" rel="stylesheet" />
	<script src="js/select2/select2.min.js"></script>
	<script type="text/javascript">
		
		$(document).ready(function() {
			var s2=$("#creditType").select2();
			initSelectData();
			s2.val("司法纠纷").trigger("change");
		});
		
		function initSelectData(){
			var html = "";
			var arr = ["司法纠纷","矛盾投诉","交费信用","其他信用"];
			for(var i = 0;i<arr.length;i++){
				html = "<option value=\""+arr[i]+"\">"+arr[i]+"</option>";
				$("#creditType").append(html);
			}
		}
		function change(obj){
			var val = $(obj).val();
			$("#creditName").text(val);
		}
		function saveDocument(){
			var content=$("#content").val();
			var customerId=$("#customerId").val();
			var creditType = $("#creditType").val();
			var url="customer/credit/addCredit";
			$.ajax({
			    type:"post",
			    async:false,
			    url:url,
		        dataType:"json",
		        data:{
		        	content:content,
		        	customerId:customerId,
		        	creditType:creditType
		        },
			    success:function(responseText){
			        if(responseText.success){
			        	//window.parent.gridObj.refreshPage();
			        	window.parent.layer.msg('保存成功！');
			        	closeLayer();
	    			}else{
	    				alert(responseText.msg, {icon: 7});
	    			}
			    }
	   		});
		}
	</script>
	
	</head>
	<body>
		<form class="cmxform" id="commentForm" method="get" action="">
		<div style="padding:20px">
		
		<div class="panel panel-default">
			<div class="panel-heading">
      			<h5 class="panel-title">基本信息</h5>
   			</div>
   			<div class="panel-body">
			<table cellpadding="10" cellspacing="5" class="mytable">
				<tr>
					<td>信用类型</td>
					<td>
						<select class="js-example-basic-single" name="creditType" id="creditType"  style="width:90px;" onchange="change(this)">
							
						</select>
					</td>
				</tr>
				<tr>
					<td width="90" id="creditName">司法纠纷</td>
					<td>
						<textarea rows="5" cols="80" id="content" name="content"></textarea>
					</td>
				</tr>
			</table>
			</div>
			</div>
			<div style="width:100%;text-align:center; padding-top:20px"> 
				<button class="btn btn-primary radius" onclick="saveDocument()" > 保 存</button> 
				 <a class="btn btn-default radius" onClick="closeLayer();"> 取 消 </a> 
		    	  <br/><br/>
	    	</div> 
	    	 
		</div>
			<!-- 客户id待完善 -->
			<input type="hidden" id="customerId" name="customerId" value="034102746ac54b3a8cc90cceff75e418"/>
		</form>
  	
   </html>
  	
